#!/bin/bash
#PBS -P zCS
#PBS -j oe
#PBS -N zCS_1
#PBS -q parallel
#PBS -l select=1:ncpus=24:mem=150GB 
# In above, a large memory size is needed to clean the SIPP dataset.

export NLSYgeogdataindicator="0" # Set to 1 if restricted geography data is available.

# Preparations. 
cd $PBS_O_WORKDIR;
STATA_ROOT="${HOME}/Stata17" # Set this to your Stata directory.
mkdir -p /scratch/$USER/stata_dir # A large scratch directory is needed to clean the SIPP dataset. 
export STATATMP=/scratch/$USER/stata_dir

# Prepare the analysis datasets.
cd /hpctmp/bizop/child_support_reppack/dofiles/misc;   ${STATA_ROOT}/stata-mp -b do get_state_rules.do
cd /hpctmp/bizop/child_support_reppack/dofiles/psid;   ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/nlsy79; ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/bhps;   ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/hilda;  ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/shp;    ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/sipp;   ${STATA_ROOT}/stata-mp -b do dataprep_master.do
cd /hpctmp/bizop/child_support_reppack/dofiles/atus;   ${STATA_ROOT}/stata-mp -b do dataprep_master.do

# Print a statistic shown in the paper. 
cd /hpctmp/bizop/child_support_reppack/dofiles/cps; ${STATA_ROOT}/stata-mp -b do SPM_statistics.do # Prints to log file directly.

# Generate tables and figures shown in the paper. 
cd /hpctmp/bizop/child_support_reppack/dofiles/combined_fathers; ${STATA_ROOT}/stata-mp -b do paper.do
cd /hpctmp/bizop/child_support_reppack/dofiles/atus;             ${STATA_ROOT}/stata-mp -b do analysis.do

